<extend name="Index/index"/>

<block name="content">
    <!--<div class="view-product" style="margin-top: 50px">-->
        <div class="info-center">
            <div class="manage-head">
                <h6 class="padding-left manage-head-con">{{$title}}</h6>
            </div>
            <div class="offcial-table input-table table-margin clearfix">
                <div class="demoTable">
                    <form action="{{:U('Comment/index')}}" method="get">
                        评论人：
                        <div class="layui-inline">
                            <input class="layui-input" name="name"  autocomplete="off">
                        </div>
                        &nbsp;时间：
                        <div class="layui-inline">
                            <input class="layui-input" style="width: 200px" name="time" id="test1"  autocomplete="off">
                        </div>
                        &nbsp;显示：
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <select name="is_show" lay-search="" class="form-control">
                                    <option value="">所有</option>
                                    <option value="2">隐藏</option>
                                    <option value="1">显示</option>
                                </select>
                            </div>
                        </div>
                        &nbsp;排序：
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <select name="order" lay-search="" class="form-control">
                                    <option value="c.id" selected>ID</option>
                                    <option value="c.create_time">发布时间</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <select name="order1" lay-search="" class="form-control">
                                    <option value="asc" selected>正序</option>
                                    <option value="desc">倒序</option>
                                </select>
                            </div>
                        </div>

                        <input type="submit" value="搜索" class="layui-btn">
                    </form>
                </div>
                <if condition="$comList eq null">
                    <div class="tr non-info show border-bottom-none">
                        <span>没查询到符合条件的记录</span>
                    </div>
                    <else />
                    <table class="layui-table text-center">
                        <colgroup>
                            <col width="5%">
                            <col width="10%">
                            <col width="30%">
                            <col width="25%">
                            <col width="10%">
                            <col width="10%">
                            <col width="20%">
                        </colgroup>
                        <tr>
                            <th class="text-center">ID</th>
                            <th class="text-center">评论人</th>
                            <th class="text-center">评论内容</th>
                            <th class="text-center">文章标题</th>
                            <th class="text-center">是否显示</th>
                            <th class="text-center">评论时间</th>
                            <th class="text-center">操作</th>
                        </tr>
                        <foreach  name="comList" item="vo" key="k">
                            <tr>
                                <input type="hidden" value="{{$vo.conent}}">
                                <td>{{$vo.id}}</td>
                                <td>{{$vo.name}}</td>
                                <td><span onclick="showDetail(this)">{{:mb_substr($vo['conent'],0,10,"utf-8")}}</span></td>
                                <td><a href="{{:U('Communicate/queryArtInfo',array('id'=>$vo['article_id']))}}">{{$vo.title}}</a></td>
                                <td>
                                    <eq name="vo.is_show" value="1">
                                        <a href="{{:U('Comment/isShow',array('id'=>$vo['id'],'show'=>$vo['is_show']))}}"><i class="layui-icon" style="color: #1E9FFF;">&#xe618;</i></a>
                                        <else/>
                                        <a href="{{:U('Comment/isShow',array('id'=>$vo['id'],'show'=>$vo['is_show']))}}"><i class="layui-icon" style="color: #1E9FFF;">&#x1006;</i></a>
                                    </eq>
                                </td>
                                <td>{{:substr($vo['create_time'],0,10)}}</td>
                                <td><span class="layui-btn layui-btn-sm layui-btn-normal" onclick="showDetail(this)">查看详情</span>
                                    <a href="{{:U('Comment/deleteCom',array('id'=>$vo['id']))}}" class="layui-btn layui-btn-sm layui-btn-danger">删除</a></td>
                            </tr>
                        </foreach>
                        <tr>
                            <td colspan="7"><div class="sabrosus">{{$page}}</div></td>
                        </tr>
                    </table>

                </if>

            </div>
        </div>
    <!--</div>-->
    <script>
        function showDetail(obj)
        {
            layui.use('layer', function(){
                var layer = layui.layer;
                layer.open({
                    title: '评论详情'
                    ,content: $(obj).parent().parent().find("input").eq(0).val()
                    ,shade : 0
                    ,btn: ['删除', '确定']
                    ,yes: function(index, layero){
                        var id = $(obj).parent().parent().find("td").eq(0).text();
                        $.ajax({
                            type : "get",
                            data : {id:id},
                            url : "{{:U('Comment/deleteComm')}}",
                            success　: function (){
                                window.location.href = "{{:U('Comment/index')}}"
                            }
                        })
                    }
                });

            });
        }
        layui.use('laydate', function() {
            var laydate = layui.laydate;
            //年选择器
            laydate.render({
                elem: '#test1'
                ,range: true
            });
        });

    </script>
</block>